<?php
/**
 *@author Connor <caokang@foxmail.com>
 *@todo
 *@link www.zeevin.com
 */
?>
<div class="title">
	<h3>日志管理</h3>
	<ul>
		<li><a href="#" title="照片管理">照片管理</a></li>
		<li class="current"><a href="#" title="日志管理">日志管理</a></li>
	</ul>
</div>
<div class="main_content">
	<div class="blog">
		<div class="write_blog"> <?php echo CHtml::link('写新日志',array('post/new'),array('title'=>'写新日志'))?></div>
		<div class="blog_list">
			<ul>
				<?php if($data['total_num']>0):;?>
                <?php foreach($data['rows'] as $k=>$v):?>
				<li>
					<div class="blog_title">
						<h2><?php echo CHtml::link(CHtml::encode($v->subject),array('post/edit','id'=>$v->id),array('title'=>CHtml::encode($v->subject)));?>
							<?php echo substr($v->ctime,0,10);?></h2>
						<span><?php echo CHtml::link('修改',array('post/edit','id'=>$v->id),array('title'=>'修改'))?></span>
						<span><?php echo CHtml::link('删除','javascript:void(0);',array('id'=>$v->id,'class'=>'delete'))?></span>
					</div>
						<p><?php echo CHtml::encode($v->sub_content),'......';?></p>
				</li>
				<?php endforeach;?>

				<?php else:?>
				<?php endif;?>

				</ul>
		</div>
			<div class="page">
				<?php $this->widget('ZLinkPager', array('pages' => $data['pages'])); ?>
			</div>
	</div>
</div>
<script type="text/javascript">
$('.delete').click(function(){
		if(confirm('确认删除？')){
			$.post('?r=post/del',{id:$(this).attr('id')},
				function(data){
					data = $.parseJSON(data);
					if(data.status=='0')location.reload();
					else alert(data.desc);
				});
		}
	});
</script>